<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <!-- <meta name="viewport" content="width=device-width, initial-scale=1.0"> -->
    <title>300ms 延迟</title>
    <script src="http://47.104.209.44/base/js/jquery-1.10.1.min.js"></script>

    <style>
        p {
            width: 90%;
            margin:30px auto;
            border:1px solid darkmagenta;
            height:50px;
            line-height: 50px;
            font-size: 30px;
            text-align: center;
        }
        span{
            color:red;
        }
    </style>
    
</head>
<body>
    <div>
        <h2>300 ms 延迟的测试 </h2>
        <p class="pt">
            touch 事件: 
            <span class="st">
                0
            </span>
            ms
        </p>
        <p class="ct">
            click 事件: 
            <span class="cs">
                0
            </span>
            ms
        </p>
    </div>

    <script>
        var start = 0;
        var end = 0;

        // touch  ===>  click  

        // touch 事件 
        $(".pt").on("touchstart",function(){
            start = new Date().getTime();
        })
        $(".pt").on("touchend",function(){
            end = new Date().getTime();
            $(".st").html(end-start)
        })
        
        // click 事件
        $(".ct").on("touchstart",function(){
            start = new Date().getTime();
        })
        $(".ct").on("click",function(){
            end = new Date().getTime();
            $(".cs").html(end-start)
        })
    </script>
</body>
</html>